using System;
using System.Data.Linq;
using System.Linq;

namespace Genrsis.WorkitemTracking.ReadLayer
{
    public class DbmlQueryContext : IQueryContext
    {
        private readonly DataContext _dataContext;

        public DbmlQueryContext(DataContext dataContext)
        {
            _dataContext = dataContext;
        }

        public IQueryable<T> All<T>()
            where T : class
        {
            return (IQueryable<T>)_dataContext.GetTable<T>();
        }

        public void Dispose()
        {
            // Allows "use()" statement
        }
    }
}